#ifndef TASKEDITOR_H
#define TASKEDITOR_H

#include <QtGui/QWidget>

#include "cdbprovider.h"
#include "WidgetTextEdit.h"
#include "answereditvariant.h"

namespace Ui {
    class TaskEditor;
}

class TaskEditor : public QWidget {
    Q_OBJECT
    Q_DISABLE_COPY(TaskEditor)
public:
    explicit TaskEditor(QWidget *parent = 0);
    virtual ~TaskEditor();

protected:
    virtual void changeEvent(QEvent *e);
    void activateTemplateAnswer();

private:
    CDBProvider *db;
    Ui::TaskEditor *m_ui;
    TextEdit *textEditorTask;
    TextEdit *textEditorHelper;
    AnswerEditVariant *answerEditor;
    void saveToDB();
    void saveTreeToDB();
    void saveDataToDB();
    void loadTree();
    void setOrders(QTreeWidgetItem * c);

private slots:
    void on_btnSetOrders_clicked();
    void on_pushButton_4_clicked();
    void on_pushButton_3_clicked();
    void on_checkBox_clicked(bool checked);
    void on_pushButton_2_clicked();
    void on_lineEdit_lostFocus();
    void on_pushButton_clicked(bool checked);
    void on_treeWidget_itemChanged(QTreeWidgetItem* item, int column);
    void on_showEditor_clicked();
    void on_treeWidget_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
    void on_treeWidget_itemCollapsed(QTreeWidgetItem* item);
    void on_treeWidget_itemClicked(QTreeWidgetItem* item, int column);
    void on_saveToDB_clicked();
    void on_renameCatalog_clicked();
    void on_deleteCatalog_clicked();
    void on_addCatalog_clicked();
    void setAnswer(int idTask);
};

#endif // TASKEDITOR_H
